<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>添加员工</title>

<script type="text/javascript" src="resource/js/jquery-2.0.3.js"></script>
<link rel="stylesheet" href="./resource/layui/css/layui.css">

</head>
<body>
		<div class="layui-container">
		<div class="layui-row" style="padding-top: 10px;">
		<div class="layui-col-md1"></div>

		<div id="div1">
	
		<div class="layui-form-item">
		<label class="layui-form-label">员工职位</label>
		<div class="layui-input-block">
		<input type="text" name="position"  id="position" required lay-verify="required" placeholder="请输入员工职位" autocomplete="off" class="layui-input"><br>
		</div>
		</div>
		
		<div class="layui-form-item">
		<label class="layui-form-label">部门id</label>
		<div class="layui-input-block">
		<input type="text" name="deptid"  id="deptid" required lay-verify="required" placeholder="请输入部门id" autocomplete="off" class="layui-input"><br>
		</div>
		</div>
		
		<div class="layui-form-item">
		<label class="layui-form-label">员工姓名</label>
		<div class="layui-input-block">
		<input type="text" name="empname"  id="empname" required lay-verify="required" placeholder="请输入员工姓名" autocomplete="off" class="layui-input"><br>
		</div>
		</div>
		
		<div class="layui-form-item">
		<label class="layui-form-label">性别</label>
		<div class="layui-input-block">
		<input type="text" name="sex"  id="sex" required lay-verify="required" placeholder="请输入性别" autocomplete="off" class="layui-input"><br>
		</div>
		</div>
		
		<div class="layui-form-item">
		<label class="layui-form-label">入职时间</label>
		<div class="layui-input-block">
		<input type="text" name="hiredate"  id="hiredate" required lay-verify="required" placeholder="请输入入职时间" autocomplete="off" class="layui-input"><br>
		</div>
		</div>
		
		<div class="layui-form-item">
		<label class="layui-form-label">薪水</label>
		<div class="layui-input-block">
		<input type="text" name="salary"  id="salary" required lay-verify="required" placeholder="请输入薪水" autocomplete="off" class="layui-input"><br>
		</div>
		</div>
		
		<div class="layui-form-item">
		<label class="layui-form-label">员工用户名</label>
		<div class="layui-input-block">
		<input type="text" name="username"  id="username" required lay-verify="required" placeholder="请输入员工用户名" autocomplete="off" class="layui-input"><br>
		</div>
		</div>

		<div class="layui-form-item">
		<label class="layui-form-label">员工密码</label>
		<div class="layui-input-block">
		<input type="text" name="password"  id="password" required lay-verify="required" placeholder="请输入员工密码" autocomplete="off" class="layui-input"><br>
		</div>
		</div>
		
		<div class="layui-form-item">
		<label class="layui-form-label">人脸识别</label>
		<div class="layui-input-block">
		<input type="text" name="faceflag"  id="faceflag" required lay-verify="required" placeholder="请输入人脸识别" autocomplete="off" class="layui-input"><br>
		</div>
		</div>
		
		<div class="layui-form-item">
		<div class="layui-input-block">
		<span id="msg"></span><br>
		<button id="add" class="layui-btn layui-btn-normal">立即提交</button>
		</div>
		</div>
		</div>
		
		</div>
		</div>
		
	<script type="text/javascript">
	$(function(){
        $("#add").on('click',function (event) {
            $.ajax({
                type:"get",//请求方式
                url:"EmpServlet?op=AddEmp",//请求地址
                data:{//数据接收
                "position":$("#position").val(),
                "deptid":$("#deptid").val(),
                "empname":$("#empname").val(),
                "sex":$("#sex").val(),
                "hiredate":$("#hiredate").val(),
                "salary":$("#salary").val(),
                "username":$("#username").val(),
                "password":$("#password").val(),
                "faceflag":$("#faceflag").val()
                },
                dataType:'json',//数据类型
                success: function(type) {//点击成功以后调用的函数
					console.log(type);//控制台显示type
					$('#msg').html(type);//span#msg 控制台显示type
                }
            });
        });
    });
	</script>
</body>
</html>